package com.sakura.mybatis.version4.enums;

/**
 * @author Sakura
 * @date 2022/6/1 17:37
 */
public enum DEPT_TYPE {
    COMPANY1("65","新分机构规则","新疆分公司","中国新疆维吾尔自治区乌鲁木齐市新市区河南东路38号天和新城市广场1+2号B座19层01、02、03、05、07、09号"),
    COMPANY2("44","广分机构规则","广东分公司","中国广东省广州市黄埔区香雪大道西280号1401房1401-1403、1405-1414室 "),
    COMPANY3("51","川分机构规则","四川分公司","四川省成都市武侯区佳灵路3号2栋6楼614号"),
    COMPANY4("83","深分机构规则","深圳分公司","深圳市罗湖区笋岗街道宝安北路与梨园路交汇外东南侧深业物流中心（南区）E栋1503B、1504、1505"),
    COMPANY5("42","湖北机构规则","湖北分公司","湖北省武汉市江汉区青年路金家墩特1号天街2号楼5F(8-13)号"),
    COMPANY6("10","前海财险总公司","前海财险总公司","")
    ;


    private String code;
    private String name;
    private String organization;
    private String address;

    DEPT_TYPE(String code, String name, String organization, String address) {
        this.code = code;
        this.name = name;
        this.organization = organization;
        this.address = address;
    }


    public String getOrganization() {
        return organization;
    }

    public void setOrganization(String organization) {
        this.organization = organization;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }


    public static String getCompanyAddress(String deptCode){
        DEPT_TYPE[] values = DEPT_TYPE.values();
        for (DEPT_TYPE value : values) {
            if(value.getCode().equals(deptCode)){
                return value.getAddress();
            }
        }
        return "";
    }

    public static String getCompanyOrganization(String deptCode){
        DEPT_TYPE[] values = DEPT_TYPE.values();
        for (DEPT_TYPE value : values) {
            if(value.getCode().equals(deptCode)){
                return value.getOrganization();
            }
        }
        return "";
    }

    public static String getInstitutionName(String deptCode){
        DEPT_TYPE[] values = DEPT_TYPE.values();
        for (DEPT_TYPE value : values) {
            if(value.getCode().equals(deptCode)){
                return value.getName();
            }
        }
        return "";
    }
}
